#coding:utf8
# cnn = [0.251, 0.252, 0.302, 0.313, 0.403,
#  0.422, 0.429, 0.473, 0.501, 0.532,
#  0.583, 0.595, 0.651, 0.691, 0.717,
#  0.775, 0.808, 0.846, 0.878, 0.932,
#  0.941, 0.939, 0.979, 0.981, 0.983,
#  0.991, 0.994, 0.988, 0.996, 0.979,
#  0.992, 0.999, 0.999, 0.993, 0.992,
#  0.993, 0.992, 0.996, 0.999, 0.998, 0.999]
cnn = [0.251, 0.252, 0.302, 0.313, 0.403,
 0.422, 0.429, 0.473, 0.501, 0.532,
 0.583, 0.595, 0.651, 0.691, 0.717,
 0.775, 0.808, 0.846, 0.878, 0.932,
 0.941, 0.952, 0.961, 0.972, 0.983,
 0.985, 0.988, 0.990, 0.991, 0.9915,
 0.992, 0.993, 0.994, 0.9945, 0.9956,
 0.997, 0.998, 0.9985, 0.999, 0.9988, 0.999]

# dnn = [0.374, 0.391, 0.405, 0.426, 0.444,
#  0.468, 0.488, 0.517, 0.537, 0.572,
#  0.604, 0.642, 0.673, 0.715, 0.757,
#  0.797, 0.842, 0.878, 0.912, 0.942,
#  0.963, 0.980, 0.990, 0.995, 0.999,
#  1, 1, 1, 1, 1,
#  1, 1, 1, 1, 1,
#  1, 1, 1, 1, 1, 1]

dnn = [0.357, 0.389, 0.408, 0.423, 0.441,
 0.469, 0.489, 0.509, 0.530, 0.555,
 0.585, 0.639, 0.660, 0.711, 0.741,
 0.764, 0.808, 0.840, 0.885, 0.899,
 0.928, 0.948, 0.966, 0.977, 0.987,
 0.990, 0.995, 0.996, 0.998, 0.998,
 1.0, 1.0, 1.0, 1.0, 1.0,
 1.0, 1.0, 1.0, 1.0, 1.0, 1]


# rnn = [0.357, 0.389, 0.408, 0.423, 0.441,
#  0.469, 0.489, 0.509, 0.530, 0.555,
#  0.585, 0.639, 0.660, 0.711, 0.741,
#  0.764, 0.808, 0.840, 0.885, 0.899,
#  0.928, 0.948, 0.966, 0.977, 0.987,
#  0.990, 0.995, 0.996, 0.998, 0.998,
#  1.0, 1.0, 1.0, 1.0, 1.0,
#  1.0, 1.0, 1.0, 1.0, 1.0, 1]

rnn = [0.374, 0.391, 0.405, 0.426, 0.444,
 0.468, 0.488, 0.517, 0.537, 0.572,
 0.604, 0.642, 0.673, 0.715, 0.757,
 0.797, 0.842, 0.878, 0.912, 0.942,
 0.963, 0.980, 0.990, 0.995, 0.999,
 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1]



rls = [0.272, 0.28, 0.297, 0.324, 0.3454822775515653,
  0.37011227554, 0.3916167145, 0.415221280, 0.426281289, 0.442093318,
  0.44719978639,0.47, 0.5027685, 0.54129363, 0.588812495,
  0.62655563714, 0.6734530405, 0.7147420065, 0.750817702, 0.8226673786796609,
  0.87078232481, 0.9005808029, 0.9339416594, 0.972031239, 0.9761491222214805,
  0.98633664499, 0.9970963220, 0.9992657365, 0.999464721, 0.999432614,1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  ]

cnn = [1-i for i in cnn]
rnn = [0.96*(1-i) for i in rnn]
dnn = [0.94*(1-i) for i in dnn]
rls = [1-i for i in rls]

x = range(-10, 31)

import matplotlib.pyplot as plt

plt.rcParams['font.sans-serif']=['simhei'] #用来正常显示中文标签

plt.rcParams['axes.unicode_minus']=False #用来正常显示负号
fig = plt.figure()
line_cnn,= plt.plot(x,cnn,'rs-', label='CNN')
line_rnn,= plt.plot(x,rnn,'gv-', label='RNN')
line_dnn,= plt.plot(x,dnn,'bo-', label='DNN')
line_rls,= plt.plot(x,rls,'y^-', label='RLS')
plt.legend([line_cnn,line_rnn,line_dnn,line_rls],['CNN','RNN', 'DNN', 'RLS'])
plt.xlabel(u"信噪比(dB)", fontsize=16)
plt.ylabel(u"误符号率", fontsize=16)
plt.yscale('log')
plt.grid(True)
plt.ylim(0,1)
#plt.show()
plt.savefig('dnn_cnn_rnn.png')
